package org.example.project3.ExceptionHandler;

import org.example.project3.Exception.AcountNotExistsException;
import org.example.project3.Exception.LoginFailedException;
import org.example.project3.Exception.PasswordNotExistsException;
import org.example.project3.Result_.Result;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class GlobalExceptionHandler {
    @ExceptionHandler(AcountNotExistsException.class)
    public Result Exceptionhandle0(){
        return Result.error("用户名为空!");
    }
    @ExceptionHandler(PasswordNotExistsException.class)
    public Result Exceptionhandle1(){
        return Result.error("密码为空!");
    }
    @ExceptionHandler(LoginFailedException.class)
    public Result Exceptionhandle2(){
        return Result.error("用户名或密码不正确!");
    }
}
